/*
 * x86_64/fp.hh - Save/restore floating point data registers.
 * Copyright (C) 2007  Mikhail Vorozhtsov
 * See the LICENSE section of the README file for details.
 */

/* $Id$ */

#ifndef HEADER_X86_64_FP_HH
#define HEADER_X86_64_FP_HH

START_NAMESPACE (x86_64)

typedef u8_t fx_image_t[512];

INLINE
static void
fx_save (const fx_image_t *image)
{
  asm volatile (
    "fxsave %0\n"
    :
    : "m"(image)
  );
}

INLINE
static void
fx_restore (fx_image_t *image)
{
  asm volatile (
    "fxrstor %0\n"
    : "=m"(image)
    : : "memory"
  );
}

END_NAMESPACE

#endif /* HEADER_X86_64_FP_HH */

